const path = require('path');
const HTMLWebpackPlugin = require('html-webpack-plugin');

module.exports = {
    mode: "development",
    entry: './src/index.jsx',
    output: {
        path: path.resolve(__dirname, 'dist'),
        publicPath: "/",
        filename: 'app.bundle.js'
    },
    module: {
        rules: [
            { test: /\.jsx?$/, use: 'babel-loader' },
            { test: /\.s?css$/, use: ['style-loader','css-loader','postcss-loader','sass-loader']}
        ]
    },
    resolve: {
        extensions: ['.js','.jsx','.json']
    },
    plugins: [
        new HTMLWebpackPlugin({
            filename: 'index.html',
            template: './index.html',
            inject:true
        })
    ],
    devServer: {
        port: 9000,
        historyApiFallback : true,
        proxy: {
            "/upload":  {
                target: "http://file.tadefan.com", //测试服务器地址
                changeOrigin:true
            },
            "/che": {
                target:"http://localhost:5000",
                changeOrigin:true
            }
        }

    }
};